//企业信用报告接口
import Cookies from "js-cookie";
import { baseURL } from "@/utils/http";
let base = baseURL
import request from '@/utils/http'
// post方法
export const myPostFetch = async function (url, params) {
  url = base + url;
  let u = "";
  if (params) {
    let paramsArray = [];
    //拼接参数  
    Object.keys(params).forEach(key => paramsArray.push(key + '=' + params[key]))
    if (url.search(/\?/) === -1) {
      u += paramsArray.join('&')
    } else {
      u += '&' + paramsArray.join('&')
    }
  }
  let options = {
    method: "POST",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
      "X-auth": localStorage.getItem("token"),

    },
    body: u,
  };
  let res = await fetch(url, options);
  let data = await res.json();
  return data;
}


// 获取企业报告详情
export function bussinessReportEdit(params) {
  return request({
    url: "/zb/getBusinessReportEdit",
    method: "post",
    params: params,
  });
}
// 下载报告
export function downloadReport(params) {
  return request({
    url: "/zb/downloadReport",
    method: "post",
    params: params,
  });
}
// 删除报告
export function delBussinessReport(params) {
  return request({
    url: "/zb/deleteReport",
    method: "post",
    params: params,
  });
}
